﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

namespace AutoRoot
{
   public class DropdownMenuKnob : MonoBehaviour
   {
      public bool listActivated
      {
         get;
         set;
      }

      public float enterTime
      {
         get;
         set;
      }

      public float exitTime
      {
         get;
         set;
      }

      public float exitY
      {
         get;
         set;
      }

      public float enterY
      {
         get;
         set;
      }

      void Start()
      {
         enterY = 0f;
         exitY = 0f;
         enterTime = 0f;
         exitTime = 0f;
      }

      void OnTouchDown(Vector3 hitPoint)
      {
         listActivated = true;
         Vector3 pos = Camera.main.WorldToScreenPoint(hitPoint);
         enterY = pos.y;
         gameObject.layer = Global.layerDropdownMenu.GetLayer();
         Camera.main.GetComponent<TouchInput>().OnDropdownMenuMode();

         enterTime = Time.time;
      }

      void Update()
      {
         GetComponent<ScaleToScreenWidth>().Start();
      }
   }
}